import { fromJS } from 'immutable';
import * as constants from './constants';
import Utils from '../../../common/utils'

const defaultState = fromJS({
	primaryList: [],
	juniorList: [],
	hightList: [],
	teacherList: [],
	subject: Utils.local('subject') ? Utils.local('subject') : [],
	courseDescript: {},
	homeLive: []
});

export default (state = defaultState, action) => {
	switch(action.type) {
		case constants.CHANGE_PRIMARY:
			return state.set('primaryList', action.value);
		case constants.CHANGE_JUNIOR:
			return state.set('juniorList', action.value);
		case constants.CHANGE_HIGHT:
			return state.set('hightList', action.value);
		case constants.CHANGE_TEACHER:
			return state.set('teacherList', action.value);
		case constants.CHANGE_SUBJECT:
			return state.set('subject', action.value);
		case constants.CHANGE_COURSEDESCRIPT:
			return state.set('courseDescript', action.value);
		case constants.CHANGE_HOMELIVE:
			return state.set('homeLive', action.value)
		default:
			return state;
	}
}